package net.gcmz.zrqblog.repository;

import java.util.List;

import net.gcmz.zrqblog.entity.User;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;



/**
 * 
 *  用户数据操作
 *  
 * @author zhangrongquan
 * @since 2014-12-11
 */

public interface UserRepository extends PagingAndSortingRepository<User, Long>,
		JpaSpecificationExecutor<User> {
	@Query(value = "select * from tb_user where id in(:ids)", nativeQuery = true)
	List<User> findAllByIds(@Param("ids") List<Long> ids);

	@Query(value = "from User where name=?1")
	User findAllByName(String name);
}